package com.cn.boot.spring.service.impl;

import com.cn.boot.spring.entity.LimitsEntity;
import com.cn.boot.spring.mapper.LimitsMapper;
import com.cn.boot.spring.service.ILimitsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LimitsServiceImpl implements ILimitsService {
    @Autowired
    private LimitsMapper limitsMapper;
    @Override
    public List<LimitsEntity> findAll() {
        return limitsMapper.findAll();
    }

    @Override
    public LimitsEntity findById(Integer id) {
        return limitsMapper.findById(id);
    }

    @Override
    public Integer add(LimitsEntity limitsEntity) {
        limitsEntity.setId(null);
        return limitsMapper.add(limitsEntity);
    }

    @Override
    public void addLimits(List<LimitsEntity> limits) {
        limits.stream().forEach(limitsMapper::add);
    }

    @Override
    public void del(List<Integer> ids) {
        ids.stream().forEach(limitsMapper::del);
    }

    @Override
    public Integer update(LimitsEntity limitsEntity) {
        return limitsMapper.update(limitsEntity);
    }
}
